<template>
  <div class="home">
    <chart-top :homeData="homeData"></chart-top>
    <ChartMain
      :x="homeData.orderFullYearAxis"
      :saleArr="homeData.orderFullYear"
      :visiteArr="homeData.userFullYear"
      :arr="homeData.orderRank"
      :arr1="homeData.userRank"
    ></ChartMain>
    <ChartFooter :searchWord="homeData.searchWord"></ChartFooter>
  </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from "vue";

import ChartTop from "@/views/Home/ChartTop/index.vue";
import ChartMain from "@/views/Home/ChartMain/index.vue";
import ChartFooter from "@/views/Home/ChartFooter/index.vue";
import { reqHomeData } from "@/api/home";

const homeData = ref<any>({}); // 主页数据

// 获取主页数据
const getHomeData = async () => {
  const result = await reqHomeData();
  console.log(result);
  homeData.value = result;
};

onMounted(() => {
  getHomeData();
});
</script>

<style scoped>
.home {
  width: 100%;
  height: 100%;
  padding: 40px;
  background: url(./1.gif);
}
</style>
